Part Number Hot Search : 
ST150A24 6152E 213ECA 00007 ZSXXX 92110 AUIRF RA8835
Product Description
Full Text Search
 

To Download HTG2150 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 Preliminary
Features
* * * * * * * * *
8-Bit 320 Pixel LCD Microcontroller
* * * * * * *
HTG2150
Operating voltage: 2.2V~3.6V 16K 16 bits program ROM 192 8 bits data RAM 8~12 bidirectional I/O lines 8 common 33~40 segment LCD driver One 16-bit programmable timer with overflow interrupts One 8-bit programmable timer with 8 stage prescaler for PFD One 8-bit programmable timer with 8 stage prescaler for Time base One 8-bit PWM audio output to directly drive speaker and buzzer
Watchdog Timer On-chip RC oscillator for system clock and 32768Hz crystal oscillator for timebase and LCD driver HALT function and wake-up feature reduce power consumption 8-level subroutine nesting Bit manipulation instructions 63 powerful instructions One interrupt input
General Description
The HTG2150 is an 8-bit high performance RISC-like microcontroller. The single cycle instruction and two-stage pipeline architecture make it suitable for high speed application. The device is ideally suited for multiple LCD low power application among which are calculators, clock timer, game, scales, toys and hand held LCD products, as well as for battery systems.
1
July 24, 2000
Preliminary
Block Diagram
S Y S C L K /4 TM R0 STACK0 STACK1 STACK2 P ro g ra m C o u n te r P ro g ra m ROM STACK3 STACK4 STACK5 STACK6 STACK7 In te rru p t C ir c u it TM R2 IN T /S E G 3 7 TM R0C 1 6 b it 8 -s ta g e P r e s c a le r PW MDAC1 M U X U X M PW MDAC2 MP0 MP1 M U X DATA M e m o ry W DTS W D T P r e s c a le r In s tr u c tio n D ecoder ALU T im in g G e n e ra to r S h ifte r MUX 256 W DTRC OSC TM R2C PFD
HTG2150
SYS CLK PW M1 PW M2
IN T C
In s tr u c tio n R e g is te r
STATUS PAC PA PBC PB PORT B PORT A PA0~PA7
OS RE VD VS S
S D
CI
ACC
P B 4 ~ P B 7 /S E G 3 3 ~ S E G 3 6
LCD M e m o ry
SYS C LK
8 -s ta g e P r e s c a le r
3 2 7 6 8 H z C ry s ta l LCD D r iv e r TM R3 8 -s ta g e P r e s c a le r M U X
CO M 0~CO M 7
SEG0 PB4~ IN T /S XOUT X IN /S
~S PB EG /S EG
EG 32 7 /S E G 3 3 ~ S E G 3 6 37 EG 38 39
TM R3C
SYS CLK PW M D /A PW MDAC1 PW MDAC2
2
July 24, 2000
Preliminary
Pad Assignment
SEG 13 SEG 12 SEG 11 SEG 10 SEG 24 SEG 23 SEG 22 SEG 21 SEG 20 SEG 19 SEG 18 SEG 17 SEG 16 SEG 15 SEG 14 SEG9
HTG2150
SEG 25 1
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
SEG 26 2 3 4 5 6 7 8 SEG 27 SEG 28 SEG 29 SEG 30 SEG 31 SEG 32 P B 4 /S E G 3 3
46 45 44 43 42 41 40 9 10 11 12 13 14 15 (0 ,0 ) 39 38 37 36 35 34 33 32 31 30 20 21 OSCI VSS
SEG8 SEG7 SEG6 SEG5 SEG4 SEG3 SEG2 SEG1 SEG0 COM7 COM6 COM5 COM4 COM3 COM2 COM1 COM0
P B 5 /S E G 3 4 P B 6 /S E G 3 5 P B 7 /S E G 3 6 IN T /S E G 3 7 X O U T /S E G 3 8 X IN /S E G 3 9
RES
16
17 PW M1
18 PW M2
19 VDD
22 PA0
23 PA1
24 PA2
25 PA3
26 PA4
27 PA5
28 PA6
29 PA7
* The IC substrate should be connected to VSS in the PCB layout artwork.
3
July 24, 2000
Preliminary
Pad Coordinates
Pad No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 X -880.45 -887.11 -887.11 -887.11 -887.11 -887.11 -887.11 -887.11 -822.70 -822.70 -822.70 -822.70 -824.04 -824.04 -823.97 -871.13 -720.90 -539.25 -404.50 -273.79 -99.06 58.61 175.41 289.41 406.21 520.21 637.01 751.01 867.81 882.36 882.36 Y 1114.46 872.13 765.63 659.03 552.53 445.93 339.43 232.83 103.48 -13.52 -127.52 -244.52 -354.49 -462.62 -580.52 -1052.80 -1052.80 -1052.80 -1051.65 -1032.67 -1097.34 -1057.70 -1057.70 -1057.70 -1057.70 -1057.70 -1057.70 -1057.70 -1057.70 -852.57 -745.97 Pad No. 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 X 882.36 882.36 882.36 882.36 882.36 882.36 882.36 882.36 882.36 882.36 882.36 882.36 882.36 882.36 882.36 824.35 717.85 611.25 504.75 398.15 291.65 185.05 78.55 -28.05 -134.55 -241.15 -347.65 -454.25 -560.75 -667.35 -773.85 Unit: mm Y -639.47 -532.87 -426.37 -319.77 -213.27 -106.67 -0.17 106.43 212.93 319.53 426.03 532.63 639.13 745.73 852.23 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46 1114.46
HTG2150
Pad Description
Pad No. 38~62 1~8 Pad Name SEG0~SEG24 SEG25~SEG32 I/O O Mask Option 3/4 Description LCD segment signal output.
9~12
PB4~PB7/ SEG33~SEG36
I/O or O
Selectable as bidirectional input/output or LCD segment signal output by mask option. On Input/Output bidirectional input/output port. Software instrucor Segment tions determine the CMOS output or schmitt trigOutput ger input with pull-high resistor. PB4~PB7 share pad with SEG33~SEG36.
4
July 24, 2000
Preliminary
Pad No. Pad Name I/O Mask Option Interrupt input or Segment 37 output Description
HTG2150
13
INT/SEG37
I or O
Selectable as external interrupt schmitt trigger input or LCD segment 37 signal output by mask option. External interrupt schmitt trigger input with pull-high resistor. Edge triggered activated on a high to low transition. INT shares pad with SEG37. Selectable as 32768Hz crystal oscillator or LCD segment signal output by mask option. Crystal oscillator (32.768kHz) for Timer 3 and LCD clock. XIN shares pad with SEG39; XOUT shares pad with SEG38. Schmitt trigger reset input. Active low without pull-high resistor. Positive PWM CMOS output Negative PWM CMOS output Positive power supply OSCI is connected to the RC network of the internal system clock. Negative power supply, ground Bidirectional 8-bit input/output port. Each bit can be configured as a wake-up input by mask option. Software instructions determine the CMOS output or schmitt trigger input with pull-high resistor. LCD common signal output
15 14
XIN/SEG39 XOUT/SEG38
I or O O
Crystal or Segment Output 3/4 CMOS CMOS 3/4 3/4 3/4 Wake-up or None Wake-up 3/4
16 17 18 19 20 21
RES PWM1 PWM2 VDD OSCI VSS
I O O 3/4 I 3/4
22~29
PA0~PA7
I/O
37~31
COM7~COM0
O
Absolute Maximum Ratings
Supply Voltage..............................-0.3V to 3.6V Input Voltage .................VSS-0.3V to VDD+0.3V Storage Temperature.................-50C to 125C Operating Temperature ..................0C to 70C
Note: These are stress ratings only. Stresses exceeding the range specified under Absolute Maximum Ratings may cause substantial damage to the device. Functional operation of this device at other conditions beyond those listed in the specification is not implied and prolonged exposure to extreme conditions may affect device reliability.
5
July 24, 2000
Preliminary
D.C. Characteristics
Symbol VDD IDD ISTB1 ISTB2 VIL1 VIH1 VIL2 VIH2 VIL3 VIH3 IOH1 IOH2 IOH3 IOL1 IOL2 IOL3 RPH Parameter Operating Voltage Operating Current (RC OSC) Standby Current With 7mA LCD Bias Option (RTC ON, LCD ON) Standby Current LCD Bias Off Option (RTC ON, LCD OFF) Input Low Voltage for PA/PB Input High Voltage for PA/PB Input Low Voltage (INT) Input High Voltage (INT) Input Low Voltage (RES) Input High Voltage (RES) Port A, Port B Source Current Segment, Common Output Source Current PWM1/PWM2 Source Current Port A, Port B Sink Current Segment, Common Output Sink Current PWM1/PWM2 Sink Current Pull-high Resistance of PA/PB and INT Test Conditions VDD Conditions 3/4 3V 3V 3V 3V 3V 3V 3V 3V 3V 3V 3V 3V 3V 3V 3V 3V 3/4 No load, fSYS=4MHz No load, HALT mode No load, HALT mode 3/4 3/4 3/4 3/4 3/4 3/4 VOH=2.7V VOH=2.7V VOH=2.7V VOL=0.3V VOL=0.3V VOH=0.3V 3/4
HTG2150
Ta=25C Min. Typ. Max. Unit 2.2 3/4 3/4 3/4 0 2.1 0 2.3 3/4 3/4 -1 -50 -8 1.5 80 12 40 3/4 1 3/4 3/4 3/4 3/4 3/4 3/4 1.5 2.4 -2 -90 -10 4 130 16 60 3.6 2 20 5 0.9 3 0.7 3 3/4 3/4 3/4 3/4 3/4 3/4 3/4 3/4 80 V mA mA mA V V V V V V mA mA mA mA mA mA kW Ta=25C
A.C. Characteristics
Symbol Parameter Test Conditions VDD 3V fSYS tRES tSST tINT System Clock (RC OSC) External Reset Low Pulse Width System Start-up Timer Period Interrupt Pulse Width 2.4V 2.2V 3/4 3/4 3/4 Conditions 3/4 3/4 3/4 3/4 Power-up or Wake-up from HALT 3/4
Min. Typ. Max. Unit 400 400 400 1 3/4 1 3/4 3/4 3/4 3/4 1024 3/4 4000 2000 kHz 1000 3/4 3/4 3/4 ms tSYS ms
Note: tSYS=1/fSYS
6 July 24, 2000
Preliminary
Functional Description
Execution flow The system clock for the HTG2150 is derived from an RC oscillator. The system clock is internally divided into four non-overlapping clocks. One instruction cycle consists of four system clock cycles. Instruction fetching and execution are pipelined in such a way that a fetch takes one instruction cycle while decoding and execution takes the next instruction cycle. However, the pipelining scheme causes each instruction to effectively execute in one cycle. If an instruction changes the program counter, two cycles are required to complete the instruction. Program counter - PC The 13-bit program counter (PC) controls the sequence in which the instructions stored in the program ROM are executed and its contents specify a maximum of 8192 addresses. After accessing a program memory word to fetch an instruction code, the contents of the program counter are incremented by one. The program counter then points to the memory word containing the next instruction code. When executing a jump instruction, conditional skip execution, loading PCL register, subroutine call, initial reset, internal interrupt, external interrupt or return from subroutine, the PC manipulates the program transfer by loading the address corresponding to each instruction.
HTG2150
The conditional skip is activated by instruction. Once the condition is met, the next instruction, fetched during the current instruction execution, is discarded and a dummy cycle replaces it to get the proper instruction. Otherwise proceed with the next instruction. The lower byte of the program counter (PCL) is a readable and writeable register (06H). Moving data into the PCL performs a short jump. The destination will be within 256 locations. When a control transfer takes place, an additional dummy cycle is required. Program memory - ROM The program memory, which contains executable program instructions, data and table information, is composed of a 16384 x 16 bit format. However as the PC (program counter) is comprised of only 13 bits, the remaining 1 ROM address bit is managed by dividing the program memory into 2 banks, each bank having a range between 0000H and 1FFFH. To move from the present ROM bank to a different ROM bank, the higher 1 bit of the ROM address are set by the BP (Bank Pointer), while the remaining 13 bits of the PC are set in the usual way by executing the appropriate jump or call instruction. As the full 14 address bits are latched during the execution of a call or jump instruction, the correct value of the BP must first be setup before a jump or call is executed. When either a software or hardware interrupt is received, note that no matter which ROM bank the proT2 T3 T4 1 3 b its P ro g ra m C o u n te r B ank0 B ank1 0000H 819216 B its 2000H 3FFFH
S y s te m C lo c k PC
T1
T2
T3
T4
T1
T2
T3
T4
T1
PC
PC+1
PC+2 S ta c k
1FFFH
F e tc h IN S T (P C ) E x e c u te IN S T (P C -1 )
F e tc h IN S T (P C + 1 ) E x e c u te IN S T (P C )
F e tc h IN S T (P C + 2 ) E x e c u te IN S T (P C + 1 )
B a n k P o in te r R e g is te r B it5
R O M A d d re s s A 1 3 b it L a tc h
L a tc h d a ta o n E x e c u tio n o f J u m p o r C a ll In s tr u c tio n 1 6 K P r o g r a m R O M A d d r e s s in g A r c h ite c tu r e
Execution flow
7 July 24, 2000
Preliminary
gram is in the program will always jump to the appropriate interrupt service address in Bank 0. The original full 14 bit address will be stored on the stack and restored when the relevant RET/RETI instruction is executed, automatically returning the program to the original ROM bank. This eliminates the need for programmers to manage the BP when interrupts occur. Certain locations in Bank 0 of program memory are reserved for special usage:
* ROM Bank 0 (BP5~BP7=000B) * Location 008H
HTG2150
This area is reserved for the timer counter 0 interrupt service program. If a timer interrupt results from a timer counter 0 overflow, and if the interrupt is enabled and the stack is not full, the program begins execution at location 008H.
D e v ic e in itia liz a tio n p r o g r a m E x te r n a l in te r r u p t s u b r o u tin e T im e r c o u n te r 0 in te r r u p t s u b r o u tin e U nused T im e r 2 in te r r u p t s u b r o u tin e T im e r 3 in te r r u p t s u b r o u tin e D /A b u ffe r e m p ty in te r r u p t P ro g ra m ROM
0000H 0004H 0008H 000CH 010H 014H 018H
The ROM bank 0 ranges from 0000H to 1FFFH. This area is reserved for the initialization program. After chip reset, the program always begins execution at location 000H.
* Location 000H
* Location 004H
This area is reserved for the external interrupt service program. If the INT input pin is activated, and the interrupt is enabled and the stack is not full, the program begins execution at location 004H. Mode
3FFFH 1 6 b its
Program memory Program Rom Address
*13 *12 *11 *10 *9 *8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
*7 0 0 0 0 0 0
*6 0 0 0 0 0 0
*5 0 0 0 0 0 0
*4 0 0 0 1 1 1
*3 0 0 1 0 0 1
*2 0 1 0 0 1 0
*1 0 0 0 0 0 0
*0 0 0 0 0 0 0
Initial reset External interrupt Timer counter 0 overflow Timer 2 overflow Timer 3 overflow D/A buffer empty interrupt Skip Loading PCL Jump, call branch Return from subroutine
PC+2 *13 *12 *11 *10 *9 *8 @7 @6 @5 @4 @3 @2 @1 @0 BP.5 #12 #11 #10 #9 #8 #7 #6 #5 #4 S4 #3 S3 #2 #1 #0 S0 S13 S12 S11 S10 S9 S8 S7 S6 S5 Program rom address S2 S1
Note: *13~*0: Program ROM address @7~@0: PCL bits #12~#0: Instruction code bits
8
S13~S0: Stack register bits BP.5: Bit 5 of bank pointer (04H)
July 24, 2000
Preliminary
* Location 010H/014H
HTG2150
This area is reserved for the timer 2/3 interrupt service program. If a timer interrupt results from a timer 2/3 overflow, and if the interrupt is enabled and the stack is not full, the program begins execution at location 010H/014H. This area is reserved for the D/A buffer empty interrupt service program. After the system latch a D/A code at RAM address 28H, the interrupt is enable, and the stack is not full, the program begins execution at location 020H. For best condition, this is the starting location for writing the program.. The range of the ROM starts from 2000H to 3FFFH. Any location in the ROM space can be used as look up tables. The instructions TABRDC [m] (use for any bank) and TABRDL [m] (only used for last page of program ROM) transfers the contents of the lower-order byte to the specified data memory, and the higher-order byte to TBLH (08H). Only the destination of t h e l ow er - or d er b y te i n t he t a b l e i s well-defined. The higher-order byte of the table word are transferred to the TBLH. The table higher-order byte register (TBLH) is read only. The table pointer (TBHP, TBLP) is a read/write register (1FH, 07H), which indicates the table location. Before accessing the table, the location must be placed in TBLP. The TBLH is read only and cannot be restored. If the main routine and the ISR (Interrupt Service Routine) both employ the table read instruction, the contents of the TBLH in *13 *12 *11 *10 #5 1 #4 1 #3 1 #2 1 *9 #1 1 *8 #0 1
* Location 018H
* Location 020H
the main routine are likely to be changed by the table read instruction used in the ISR. Errors can occur. In other words, using the table read instruction in the main routine and the ISR simultaneously should be avoided. However, if the table read instruction has to be applied in both the main routine and the ISR, the interrupt is supposed to be disabled prior to the table read instruction. It will not be enabled until the TBLH has been backed up. All table related instructions need two cycles to complete the operation. These areas may function as normal program memory depending upon the requirements. Stack register - STACK This is a special part of the memory which is used to save the contents of the program counter (PC) only. The stack is organized into eight levels and is neither part of the data nor part of the program space, and is neither readable nor writeable. The activated level is indexed by the stack pointer (SP) and is neither readable nor writeable. At a subroutine call or interrupt acknowledgment, the contents of the program counter and ROM address A13 bit latch Data are pushed onto the stack. At the end of a subroutine or an interrupt routine, signaled by a return instruction (RET or RETI), the program counter and ROM address A13 bit latch Data are restored to its previous value from the stack. After a chip reset, the SP will point to the top of the stack. If the stack is full and a non-masked interrupt takes place, the interrupt request flag will be recorded but the acknowledgment will be inhibited. When the stack pointer is decremented (by RET or RETI), the interrupt will be serviced. This feature prevents stack overflow allowing the proTable Location *7 @7 @7 *6 @6 @6 *5 @5 @5 *4 @4 @4 *3 @3 @3 *2 @2 @2 *1 @1 @1 *0 @0 @0
* ROM Bank 1 (BP5~BP7=001B)
* Table location
Instruction(s) TABRDC [m] TABRDL [m]
Table location Note: @7~@0: TBLP register bit 7~bit 0 #5~#0: TBHP register bit 13~bit 8
9
*13~*0: Current Program ROM table address bit 13~bit 0
July 24, 2000
Preliminary
grammer to use the structure more easily. In a similar case, if the stack is full and a CALL is subsequently executed, stack overflow occurs and the first entry will be lost (only the most recent eight return address are stored).
00H 01H 02H 03H 04H 05H 06H 07H 08H 09H 0AH 0BH 0C H 0D H 0EH 0FH 10H 11H 12H 13H 14H 15H 16H 17H 18H 19H 1AH 1BH 1C H 1DH 1EH 1FH 20H 21H 22H 23H 24H 25H 26H 27H 28H 29H 2AH 2BH 2CH 2DH 2EH 2FH 30H LCDC COMR LCD C o n tr o l R e g is te r C o m m o n P a d A d d re s s R o ta to r TM R3 TM R3C X 'T A L C PW MC PW M T im e r 3 R e g is te r T im e r 3 C o n tr o l R e g is te r X 't a l F a s t O s c illa t o r u p C o n t r o l PW M PW M C o n tro l D a ta TM R2 TM R2C T im e r 2 R e g is te r T im e r 2 C o n tr o l R e g is te r IN T C H TBHP In te r r u p t C o n tr o l H ig h e r - o r d e r B y te R e g is te r T a b le P o in te r H ig h e r - o r d e r B y te R e g is te r PA PAC PB PBC P A I/O P A I/O P B I/O P B I/O D a ta R e g is te r C o n tr o l R e g is te r D a ta R e g is te r C o n tr o l R e g is te r S p e c ia l P u r p o s e D a ta M e m o ry IA R 0 MP0 IA R 1 MP1 BP ACC PCL TBLP TBLH W DTS STATUS IN T C TM R0H TM R0L TM R0C P ro g ra m In d ir e c t A d d r e s s in g R e g is te r 0 M e m o r y P o in te r 0 In d ir e c t A d d r e s s in g R e g is te r 1 M e m o r y P o in te r 1 B a n k P o in te r A c c u m u la to r C o u n te r L o w e r - b y te R e g is te r T a b le P o in te r L o w e r - o r d e r B y te R e g is te r T a b le H ig h e r - o r d e r B y te R e g is te r W a tc h d o g T im e r O p tio n S e ttin g R e g is te r S ta tu s R e g is te r In te r r u p t C o n tr o l R e g is te r T im e r C o u n te r 0 H ig h e r - o r d e r B y te R e g is te r T im e r C o u n te r 0 L o w e r - o r d e r B y te R e g is te r T im e r C o u n te r 0 C o n tr o l R e g is te r
HTG2150
Data memory - RAM
* Bank 0 (BP4~BP0=00000)
The Bank 0 data memory includes special purpose and general purpose memory. The special purpose memory is addressed from 00H to 2FH, while general purpose memory is addressed from 40H to FFH. All data memory areas can handle arithmetic, logic, increment, decrement and rotate operations directly. Except for some dedicated bits, each bit in the data memory can be set and reset by the SET [m].i and CLR [m].i instructions, respectively. They are also indirectly accessible through the memory pointer registers (MP0;01H, MP1;03H). The range of RAM starts from 80H to A7H. On the LCD, every bit stands for one dot. If the bit is 1, the light of the dot on the LCD will be turned on. If the bit is 0, then it will be turned off. Only MP1 can deal with the memory of this range. The contrast form of RAM location, COMMON, and SEGMENT is as follows.
* Bank 15 (BP4~BP0=01111B)
Indirect addressing register Location 00H and 02H are indirect addressing registers that are not physically implemented. Any read/write operation of [00H] and [02H] access data memory are pointed to by MP0 (01H) and MP1 (03H) respectively. Reading location 00H or 02H indirectly will return the result 00H. Writing indirectly results in no operation. The function of data movement between two indirect addressing registers, is not supported. The memory pointer registers, MP0 and MP1, are 8-bit registers which can be used to access the data memory by combining corresponding indirect addressing registers but Bank 15 can use MP1 only. Accumulator The accumulator is closely related to ALU operations. It is also mapped to location 05H of the data memory and it can carry out immediate data operations. The data movement between two data memories has to pass through the accumulator.
3FH 40H
:U nused G e n e ra l P u rp o s e B a n k 0 D a ta M e m o ry (1 9 2 B y te ) R e a d a s "0 0 " P B b it 3 /2 /1 /0 R e a d = 0
FFH 80H B a n k 1 5 D a ta M e m o ry (4 0 B y te ) A7H
RAM mapping
10
July 24, 2000
Preliminary
LCD driver output The maximum output number of the HTG2150 LCD driver is 840. The LCD driver bias type is R type, no external capacitor is required and the bias voltage is 1/4 bias. Some of the Segment outputs share pins with another pins, PB4~PB7 (SEG33~SEG36), INT (SEG37), XOUT (SEG38), XIN (SEG39). Whether segment output or I/O pin canindividuallybedecidedbymaskoption.
32Hz 1 512Hz 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5
HTG2150
LCD driver output can be enabled or disabled by setting the LCD (bit 6 of LCDC; 2EH) without the influence of the related memory condition. There is a special function for LCD display, which is Rotate function. There are 8 kinds of Rotate function, (user can change the data of the SS0 to SS3.) An example of an lcd driving waveform (1/8 duty, 1/4 bias) is shown below.
COM0
VDD 3 /4 V D D 2 /4 V D D 1 /4 V D D GND VDD 3 /4 V D D 2 /4 V D D 1 /4 V D D GND
COM1
SEG0
VDD 3 /4 V D D 2 /4 V D D 1 /4 V D D GND
L C D d is p la y m e m o r y : (B a n k 1 5 )
A d d re s s COM0 COM1 COM2 COM3 COM4 COM5 COM6 COM7 80H B it0 B it1 B it2 B it3 B it4 B it5 B it6 B it7 SEG0 SEG1 SEG2 SEG3 SEG4 SEG5 SEG 17 SEG 18 SEG 39 81H 82H 83H 84H 85H 91H 92H A7H
11
July 24, 2000
Preliminary
Register Bit No. 0~5 LCDC 6 7 Label 3/4 LCD RC Function Can R/W (Default 000000B)
HTG2150
Control the LCD output (0=disable; 1=enabled) (Default=1) LCD clock source select (Default=0) 1= 32768Hz crystal 0= system clock LCDC register
Rotate SSL3 SSL2 SSL1 SSL0 x x x x x x x x 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1
Description The Pad of common 0 is connected to common 0 and the Pad of common 1 is connected to common 1 and so on. The Pad of common 0 is connected to common 1 and the Pad of common 1 is connected to common 2 and so on. The Pad of common 0 is connected to common 2 and the Pad of common 1 is connected to common 3 and so on. The Pad of common 0 is connected to common 3 and the Pad of common 1 is connected to common 4 and so on. The Pad of common 0 is connected to common 4 and the Pad of common 1 is connected to common 5 and so on. The Pad of common 0 is connected to common 5 and the Pad of common 1 is connected to common 6 and so on. The Pad of common 0 is connected to common 6 and the Pad of common 1 is connected to common 7 and so on. The Pad of common 0 is connected to common 7 and the Pad of common 1 is connected to common 0 and so on. 2FH register
12
July 24, 2000
Preliminary
Arithmetic and logic unit - ALU This circuit performs 8-bit arithmetic and logic operation. The ALU provides the following functions:
* Arithmetic operations (ADD, ADC, SUB, * * * *
HTG2150
give different results from those intended. The TO and PD flags can only be changed by system power up, Watchdog Timer overflow, executing the HALT instruction and clearing the Watchdog Timer. The Z, OV, AC and C flags generally reflect the status of the latest operations. In addition, on entering the interrupt sequence or executing the subroutine call, the status register will not be automatically pushed onto the stack. If the contents of status are important and if the subroutine can corrupt the status register, precautions must be taken to save it properly. Interrupt The HTG2150 provides an external interrupt and a PWM D/A interrupt and internal timer interrupts. The Interrupt Control register (INTC;0BH, INTCH;1EH) contains the interrupt control bits to set the enable/disable and the interrupt request flags. Once an interrupt subroutine is serviced, all other interrupts will be blocked (by clearing the EMI bit). This scheme may prevent any further interrupt nesting. Other interrupt requests may happen during this interval but only the interFunction
SBC, DAA) Logic operations (AND, OR, XOR, CPL) Rotation (RL, RR, RLC, RRC) Increment and Decrement (INC, DEC) Branch decision (SZ, SNZ, SIZ, SDZ ....)
The ALU not only saves the results of a data operation but also changes the status register. Status register - STATUS This 8-bit register (0AH) contains the zero flag (Z), carry flag (C), auxiliary carry flag (AC), overflow flag (OV), power down flag (PD) and watchdog time-out flag (TO). It also records the status information and controls the operation sequence. With the exception of the TO and PD flags, bits in the status register can be altered by instructions like any other register. Any data written into the status register will not change the TO or PD flags. In addition it should be noted that operations related to the status register may Labels C Bits 0
C is set if the operation results in a carry during an addition operation or if a borrow does not take place during a subtraction operation; otherwise C is cleared. C is also affected by a rotate through carry instruction. AC is set if the operation results in a carry out of the low nibbles in addition or no borrow from the high nibble into the low nibble in subtraction; otherwise AC is cleared. Z is set if the result of an arithmetic or logic operation is zero; otherwise Z is cleared. OV is set if the operation results in a carry into the highest-order bit but not a carry out of the highest-order bit, or vice versa; otherwise OV is cleared. PD is cleared when either a system powers up or a CLR WDT instruction is executed. PD is set by executing the HALT instruction. TO is cleared by a system power-up or executing the CLR WDT or HALT instruction. TO is set by a WDT time-out. Undefined bits, read as 0. Status register
13 July 24, 2000
AC Z OV PD TO 3/4
1 2 3 4 5 6, 7
Preliminary
rupt request flag is recorded. If a certain interrupt needs servicing within the service routine, the programmer may set the EMI bit and the corresponding bit of the INTC to allow interrupt nesting. If the stack is full, the interrupt request will not be acknowledged, even if the related interrupt is enabled, until the SP is decremented. If immediate service is desired, the stack must be prevented from becoming full. All these kinds of interrupt have a wake-up capability. As an interrupt is serviced, a control transfer occurs by pushing the program counter and A13 bit onto the stack followed by a branch to subroutines at specified locations in the program memory. Only the program counter and A13 bit are pushed onto the stack. If the contents of the register and Status register (STATUS) are altered by the interrupt service program which corrupt the desired control sequence, the contents should be saved first. External interrupt is triggered by a high to low transition of INT and the related interrupt request flag (EIF; bit 4 of INTC) will be set. When the interrupt is enabled, and the stack is not full and the external interrupt is active, a subroutine call to location 04H will occur. The interrupt request flag (EIF) and EMI bits will be cleared to disable other interrupts. The internal timer counter 0 interrupt is initialized by setting the timer counter 0 interrupt Register Bit No. 0 1 2 INTC 3 4 5 6, 7 Label EMI EEI ET0I 3/4 EIF T0F 3/4
HTG2150
request flag (T0F; bit 5 of INTC), resulting from a timer 0 overflow. When the interrupt is enabled, and the stack is not full and the T0F bit is set, a subroutine call to location 08H will occur. The related interrupt request flag (T0F) will be reset and the EMI bit cleared to disable further interrupts. The Timer 2/3 interrupts are operated in the same manner as timer 0. While ET2I/ET3I and T2F/T3F are the related control bits and the related request flags of TMR2/TMR3, which locate at bit0/bit1 and bit4/bi5 of the INTCH respectively. During the execution of an interrupt subroutine, other interrupt acknowledgments are held until the RETI instruction is executed or the EMI bit and the related interrupt control bit are set to 1 ( if the stack is not full). To return from the interrupt subroutine, the RET or RETI instruction may be invoked. RETI will set the EMI bit to enable an interrupt service, but RET will not. Interrupts occurring in the interval between the rising edges of two consecutive T2 pulses, will be serviced on the latter of the two T2 pulses, if the corresponding interrupts are enabled. In the case of simultaneous requests the priorities applied are shown in the following table. These can be masked by resetting the EMI bit. Function
Controls the (global) interrupt (1=enable; 0=disable) Controls the external interrupt (1=enable; 0=disable) Controls the timer counter 0 interrupt (1=enable; 0=disable) Unused bit External interrupt request flag (1=active; 0=inactive) Internal timer counter 0 request flag (1=active; 0=inactive) Unused bit INTC register
14
July 24, 2000
Preliminary
Register Bit No. 0 1 2 INTCH 3 4 5 6 7 Label ET2I ET3I PWMI 3/4 T2F T3F PWMF 3/4 Function Controls the Timer 2 interrupt (1=enable; 0=disable) Controls the Timer 3 interrupt (1=enable; 0=disable) PWM D/A interrupt (1=enable; 0=disable) Should be set as 0 always Internal Timer 2 request flag (1=active; 0=inactive) Internal Timer 3 request flag (1=active; 0=inactive) PWM D/A flag (1=active; 0=inactive) Should be set as 0 always INTCH register No. Interrupt Source Priority Vector a b d e f External interrupt Timer counter 0 overflow Timer 2 overflow Timer 3 overflow PWM D/A interrupt 1 2 4 5 6 04H 08H 10H 14H 18H
HTG2150
and enabling the interrupt is not well controlled, the CALL subroutine should not operate in the interrupt subroutine as it will damage the original control sequence. Oscillator configuration There are two oscillator circuits in the HTG2150.
OSCI X IN
The timer counter 0 and Timer 2/3 interrupt request flag (T0F/T2F/T3F), External interrupt request flag (EIF), PWM D/A interrupt request flag (PWMF),Enable Timer 0/2/3 bit (ET0I/ET2I/ET3I) , Enable PWM D/A interrupt (PWMI), Enable external interrupt bit (EEI) and Enable master interrupt bit (EMI) constitute an interrupt control register (INTC/INTCH) which is located at 0BH/1EH in the data memory. EMI, EEI, ET0I, ET2I, ET3I, PWMI are used to control the enabling/disabling of interrupts. These bits prevent the requested interrupt from being serviced. Once the interrupt request flags (T0F, T2F, T3F, EIF, PWMF) are set, they will remain in the INTC/INTCH register until the interrupts are serviced or cleared by a software instruction. It is recommended that a program does not use the CALL subroutine within the interrupt subroutine. Interrupts often occur in an unpredictable manner or need to be serviced immediately in some applications. If only one stack is left
15
32768Hz RC O s c illa to r
XOUT
RTC
O s c illa to r
System and RTC oscillator The RC oscillator signal provides the internal system clock. The HALT mode stops the system oscillator and ignores any external signal to conserve power. Only the RC oscillator is designed to drive the internal system clock. The RTC oscillator provides the Timer 3 and LCD driver clock source. The RC oscillator needs an external resistor connected between OSCI and VSS. The resistance value must range from 50kW to 400kW. However, the frequency of the oscillation may vary with VDD, temperature and the chip itself due to process variations. It is, therefore, not suitable for timing sensitive operations where accurate oscillator frequency is desired.
July 24, 2000
Preliminary
There is another oscillator circuit designed for the real time clock. In this case, only the 32768Hz crystal can be applied. The crystal should be connected between XIN and XOUT, and two external capacitors are required for the oscillator circuit in order to get a stable frequency. The RTC oscillator is used to provide clock source for the LCD driver and Timer 3. It can be enabled or disabled by mask option. The WDT oscillator is a free running on-chip RC oscillator, requiring no external components. Even if the system enters the power down mode, and the system clock is stopped, the WDT oscillator still runs with a period of approximately 78ms. The WDT oscillator can be disabled by mask option to conserve power. Watchdog Timer - WDT The WDT clock source is implemented by a dedicated RC oscillator (WDT oscillator). This timer is designed to prevent a software malfunction or sequence jumping to an unknown location with unpredictable results. The Watchdog Timer can be disabled by mask option. If the Watchdog Timer is disabled, all the executions related to WDT result in no operation. When the internal WDT oscillator (RC oscillator with 83ms period normally) is enable, it is first divided by 256 (8 stages) to get the nominal time-out period of approximately 21ms. This time-out period may vary with temperature, VDD and process variations. By invoking the WDT prescaler, longer time-out periods can be realized. Writing data to WS2, WS1, WS0 (bits 2,1,0 of the WDTS) can give different time-out periods. If WS2, WS1, WS0 are all equal to 1, the division ratio is up to 1:128, and the maxiWS2 0 0 0 0 1 1 1 1 WS1 0 0 1 1 0 0 1 1 WS0 0 1 0 1 0 1 0 1 WDTS register
HTG2150
Division Ratio 1:1 1:2 1:4 1:8 1:16 1:32 1:64 1:128
mum time-out period is 2.6 seconds.
The WDT overflow under normal operation will initialize chip reset and set the status bit TO. Whereas in the HALT mode, the overflow will initialize a warm reset only the PC and SP are reset to zero. To clear the WDT contents (including the WDT prescaler), three methods are adopted; external reset (a low level to RES), software instructions, or a HALT instruction. The software instruction is CLR WDT, execution of the CLR WDT instruction will clear the WDT. Power down operation - HALT The HALT mode is initialized by the HALT instruction and results in the following...
* The system oscillator will turn off but the
WDT oscillator keeps running (if the WDT oscillator is selected). * The contents of the on-chip RAM and registers remain unchanged. * WDT and WDT prescaler will be cleared and do recounting again.
W DT OSC
W D T P r e s c a le r 8 - b it C o u n te r 7 - b it C o u n te r
8 -to -1 M U X W D T T im e - o u t
W S0~W S2
Watchdog Timer
16
July 24, 2000
Preliminary
* All I/O ports maintain their original status. * The PD flag is set and the TO flag is cleared.
HTG2150
Reset There are three ways in which a reset can occur:
* RES reset during normal operation * RES reset during HALT * WDT time-out reset during normal operation
The system can leave the HALT mode by means of an external reset, an interrupt, an external falling edge signal on port A or a WDT overflow. An external reset causes a device initialization and the WDT overflow performs a warm reset. By examining the TO and PD flags, the reason for chip reset can be determined. The PD flag is cleared when the system powers up or upon executing the CLR WDT instruction and is set when the HALT instruction is executed. The TO flag is set if the WDT time-out occurs, and causes a wake-up that only resets the PC and SP, the others maintain their original status. The port A wake-up and interrupt methods can be considered as a continuation of normal execution. Each bit in port A can be independently selected to wake up the device by mask option. Awakening from an I/O port stimulus, the program will resume execution of the next instruction. If awakening from an interrupt, two sequences may happen. If the related interrupt is disabled or the interrupt is enabled but the stack is full, the program will resume execution at the next instruction. If the interrupt is enabled and the stack is not full, the regular interrupt response takes place. Once a wake-up event occurs, it takes 1024 tSYS (system clock period) to resume normal operation. In other words, a dummy cycle period will be inserted after the wake-up. If the wake-up results from an interrupt acknowledge, the actual interrupt subroutine will be delayed by one more cycle. If the wake-up results in the next instruction execution, this will be executed immediately after a dummy period has finished. If an interrupt request flag is set to 1 before entering the HALT mode, the wake-up function of the related interrupt will be disabled. To minimize power consumption, all I/O pins should be carefully managed before entering the HALT status.
The WDT time-out during HALT is different from other chip reset conditions, since it can perform a warm reset that just resets the PC and SP, leaving the other circuits in their original state. Some registers remain unchanged during other reset conditions. Most registers are reset to the initial condition when the reset conditions are met. By examining the PD and TO flags, the program can distinguish between different chip resets. TO 0 u 0 1 1 PD 0 u 1 u 1 RESET Conditions RES reset during power-up RES reset during normal operation RES wake-up HALT WDT time-out during normal operation WDT wake-up HALT
Note: u means unchanged To guarantee that the system oscillator has started and stabilized, the SST (System Start-up Timer) provides an extra-delay of 1024 system clock pulses when the system powers up or awakes from the HALT state. When a system power-up occurs, the SST delay is added during the reset period. But when the reset comes from the RES pin, the SST delay is disabled. Any wake-up from HALT will enable the SST delay.
17
July 24, 2000
Preliminary
The functional unit chip reset status are shown below. PC Interrupt Prescaler WDT Timer (0/2/3) LCD Display Pull-high of RESB Input/output Ports SP
VDD
HTG2150
Timer 0 The timer 0 contains 16-bit programmable count-up counters and the clock source come from the system clock divided by 4. There are three registers related to timer counter 0; TMR0H (0CH), TMR0L (0DH), TMR0C (0EH). Writing TMR0L only writes the data into a low byte buffer, and writing TMR0H will write the data and the contents of the low byte buffer into the timer 0 preload register (16-bit) simultaneously. The timer 0 preload register is changed by writing TMR0H operations and writing TMR0L will keep the timer 0 preload register unchanged. Reading TMR0H will also latch the TMR0L into the low byte buffer to avoid the false timing problem. Reading TMR0L returns the contents of the low byte buffer. In other words, the low byte of timer counter 0 cannot be read directly. It must read the TMR0H first to make the low byte contents of timer 0 be latched into the buffer. The TMR0C is the timer 0 control register, which defines the timer 0 options.
000H Disable Clear Clear. After master reset, WDT begins counting Off Enable with Input mode Points to the top of the stack
RES
S S T T im e - o u t C h ip R eset
tS
ST
Reset timing chart
V
DD
The timer counter control registers define the operating mode, counting enable or disable and active edge. If the timer counter starts counting, it will count from the current contents in the timer counter to FFFFH. Once an overflow occurs, the counter is reloaded from the timer counter preload register and generates the corresponding interrupt request flag (T0F; bit of INTC) at the same time. To enable the counting operation, the Timer ON bit (TON; bit 4 of TMR0C) should be set to 1. The overflow of the timer counter is one of the wake-up sources. No matter what the operation mode is, writing a 0 to ET0I can disable the corresponding interrupt service. In the case of timer counter OFF condition, writing data to the timer counter preload register will also reload that data to the timer counter. But if the timer counter is turned on, data written to the timer counter will only be kept in the timer counter preload register. The timer counter will still operate until overflow occurs.
18 July 24, 2000
RES
Reset circuit
HALT W DT W DT T im e - o u t R eset W a rm R eset
RES SST 1 0 -s ta g e R ip p le C o u n te r P o w e r - o n D e te c tio n C o ld R eset
OSC1
Reset configuration
Preliminary
The state of the registers is summarized in the following table: Register TMR0H TMR0L TMR0C TMR2 TMR2C TMR3 TMR3C INTCH TBHP Program Counter MP0 MP1 ACC TBLP TBLH STATUS BP LCDC INTC WDTS PA PAC PB PBC COMR PWMC PWM XTALC Reset (Power On) xxxx xxxx xxxx xxxx 00-0 1--xxxx xxxx 00-0 1000 xxxx xxxx 00-0 1000 0000 0000 xxxx xxxx 0000H xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx --00 xxxx 0000 0000 0100 0000 0000 0000 0000 0111 1111 1111 1111 1111 1111 0000 1111 0000 0000 0000 1111 1111 xxxx xxxx 0000 0000 WDT Time-out (Normal Operation) uuuu uuuu uuuu uuuu 00-0 1--uuuu uuuu 00-0 1000 uuuu uuuu 00-0 1000 0000 0000 uuuu uuuu 0000H uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu --1u uuuu 0000 0000 0100 0000 0000 0000 0000 0111 1111 1111 1111 1111 1111 0000 1111 0000 0000 0000 1111 1111 xxxx xxxx 0000 0000 RES Reset (Normal Operation) uuuu uuuu uuuu uuuu 00-0 1--uuuu uuuu 00-0 1000 uuuu uuuu 00-0 1000 0000 0000 uuuu uuuu 0000H uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu --uu uuuu 0000 0000 0100 0000 0000 0000 0000 0111 1111 1111 1111 1111 1111 0000 1111 0000 0000 0000 1111 1111 xxxx xxxx 0000 0000 RES Reset (HALT) uuuu uuuu uuuu uuuu 00-0 1--uuuu uuuu 00-0 1000 uuuu uuuu 00-0 1000 0000 0000 uuuu uuuu 0000H uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu --01 uuuu 0000 0000 0100 0000 0000 0000 0000 0111 1111 1111 1111 1111 1111 0000 1111 0000 0000 0000 1111 1111 xxxx xxxx 0000 0000
HTG2150
WDT Time-out (HALT) uuuu uuuu uuuu uuuu uu-u u--uuuu uuuu uu-u uuuu uuuu uuuu uu-u uuuu uuuu uuuu uuuu uuuu 0000H* uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu --11 uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu 0000 uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu
Note: * means warm reset u means unchanged x means unknown
19
July 24, 2000
Preliminary
Label 3/4 TE TON 3/4 TM0, TM1 Bits 0~2 3 4 5 6, 7 Unused bits, read as 0. To define the TMR0 active edge of the timer counter (0=active on low to high; 1=active on high to low) To enable/disable timer counting (0=disabled; 1=enabled) Unused bits, read as x. 0, 1=Internal clock TMR0C register When the timer counter (reading TMR0H) is read, the clock will be blocked to avoid errors. As this may results in a counting error, this must be taken into consideration by the programmer.
D a ta B u s T im e r C o u n te r 0 P r e lo a d R e g is te r R e lo a d
HTG2150
Function
FFH. Once an overflow occurs, the counter is reloaded from a preload register, and generates an interrupt request flag (T2F; bit 4 of INTCH). To enable the counting operation, the timer On bit (TON; bit 4 of TMR2C) should be set to 1. For proper operation, bit 6 of TMR2C should be set to 1 and bit 3, bit7 should be set to 0. The Timer 2 can also be used as PFD output by setting PWM1 and PWM2 to be PFD and PFDB output respectively by 2FH.7 and 2FH.6. When the PFD/PFDB function is selected, setting 2FH.4/2FH.5 to 1 will enable the PFD/PFDB output and setting 2FH.4/2FH.5 to 0 will disable the PFD/PFDB output. PFD Frequency: T2f/[256-TMR2)2] Timer 3 has the same structure and operating manner with Timer 2, except for clock source and PFD function. The Timer 3 can be used as a time base to generate a regular internal interrupt. The clock source of Timer 3 can come from RTC OSC (XTAL 32kHz) or system clock divided by an 8-stage prescaler. If the RTC mask option is enabled, a 32kHz crystal is needed across XIN and XOUT pins. The 32kHz signal is processed by an 8-stage prescaler to yield various counting clock for Timer 3. There are 2 registers related to Timer 3; TMR3 (24H) and TMR3C (25H). Writing data to B2, B1, B0 (bit 2, 1, 0 of TMR3C) can yield various counting clock.
S y s te m C lo c k /4
T im e r C o u n te r 0
O v e r flo w T o In te rru p t
L o w B y te B u ffe r
Timer counter 0 Timer 2/3 Timer 2 is an 8-bit counter, and its clock source comes from the system clock divided by an 8-stage prescaler. There are two registers related to Timer 2 ; TMR2 (21H) and TMR2C (22H). Two physical registers are mapped to TMR2 location; writing TMR2 makes the starting value be placed in the Timer 2 preload register and reading the TMR2 gets the contents of the Timer 2 counter. The TMR2C is a control register, which defines the division ratio of the prescaler and counting enable or disable. Writing data to B2, B1 and B0 (bits 2, 1, 0 of TMR2C) can yield various clock sources. Once the Timer 2 starts counting, it will count from the current contents in the counter to
20
July 24, 2000
Preliminary
D a ta B u s 8 -s ta g e P r e s c a le r T2f TON T im e r 2 O v e r flo w T im e r 2 P r e lo a d R e g is te r R e lo a d
HTG2150
SYS C LK
T o in te r r u p t 2 2 F H .5 2 F H .4 PW M 1 dac 2 F H .6 PW M2 dac PW M2 2 F H .7 PW M1
Timer 2 Label SSL 3~0 PFD PFDB PWM1 PWM2 Bits 3~0 4 5 6 7 LCD common used To enable/disable PFD output (0=disable; 1=enable) To enable/disable PFDB output (0=disable; 1=enable) To select PFDB/PWM1 output (0=PWM1; 1=PFDB) To select PFD/PWM2 output (0=PWM2; 1=PFD) 2FH register Function
S y s te m C lo c k
8 S ta g e P r e s c a le r m a s k o p tio n
F0
near32768H z T3f 8 S ta g e P r e s c a le r TON 2 E H .7 64
P r e lo a d
F1 3 2 K X 'A T L
T im e r 3 L C D D r iv e r (5 1 2 H z )
IN T
Timer 3
21
July 24, 2000
Preliminary
TMR2C Bit 2 Bit 1 Bit 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 T2f SYS CLK/2 SYS CLK/4 SYS CLK/8 SYS CLK/16 SYS CLK/32 SYS CLK/64 SYS CLK/128 SYS CLK/256 TMR3C Bit 2 Bit 1 Bit 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 F1/2 F1/4 F1/8 F1/16 F1/32 F1/64 F1/128 F1/256
HTG2150
T3f
TMR2C bit 4 to enable/disable timer counting (0=disable;1=enable) TMR2C bit 3 always write 0 TMR2C bit 5 always write 0 TMR2C bit 6 always write 1 TMR2C bit 7 always write 0 F1 can select 4 frequency by mask option Auto Mask Option SYS CLK near 512kHz SYS CLK near 1024kHz SYS CLK near 2048kHz SYS CLK near 4096kHz F0 SYS CLK/16 SYS CLK/32 SYS CLK/64 SYS CLK/128
Time base frequency= T3f / (256 - TMR3) TMR3C bit 4 to enable/disable timer counting (0=disable; 1=enable) TMR3C bit 3 always write 0 TMR3C bit 5 always write 0 TMR3C bit 6 always write 1 TMR3C bit 7 always write 0
22
July 24, 2000
Preliminary
Input/output ports There are 12 bidirectional input/output lines in the HTG2150, labeled PA and PB, which are mapped to the data memory of [12H], [14H], respectively. All these I/O ports can be used for input and output operations. For input operation, these ports are non-latching, that is, the inputs must be ready at the T2 rising edge of instruction MOV A,[m] (m=12H, 14H). For output operation, all data is latched and remains unchanged until the output latch is rewritten. Each I/O line has its own control register (PAC, PBC) to control the input/output configuration. With this control register, CMOS output or schmitt trigger input with or without pull-high resistor (mask option) structures can be reconfigured dynamically under software control. To function as an input, the corresponding latch of the control register must write 1. The pull-high resistance will exhibit automatically if the pull-high option is selected. The input source also depends on the control register. If the control register bit is 1, the input will read the pad state. If the control register bit is 0, the contents of the latches will move to the int e r n a l b us . T he l a t ter i s p os s i b l e i n read-modify-write instruction. For output function, CMOS is the only configuration. These control registers are mapped to locations 13H, 15H.
HTG2150
After a chip reset, these input/output lines stay at high levels or floating (mask option). Each bit of these input/output latches can be set or cleared by the SET [m].i or CLR [m].i (m=12H, 14H) instruction. Some instructions first input data and then follow the output operations. For example, the SET [m].i, CLR [m].i, CPL [m] and CPLA [m] instructions read the entire port states into the CPU, execute the defined operations (bit-operation), and then write the results back to the latches or the accumulator. Each line of port A has the capability to wake-up the device. Port B are share pad, each pin function are defined by mask option, the PB7 shares with SEG36. The PB6, PB5 and PB4 share with SEG35, SEG34 and SEG33. If the segment output is selected, the related I/O register (PB) cannot be used as general purpose register. Reading the register will result to an unknown state. PWM interface The HTG2150 provides an 8 bit (bit 7 is a sign bit) PWM D/A interface, which is good for speech synthesis. The user can record or synthesize the sound and digitize it into the program ROM. These sound could be played back in sequence of the functions as designed by the internal program ROM. There are several algorithms that can be used in the HTG2150, they are ... PCM, mLAW, DPCM, ADPCM..... .
Q V V
DD
DATA Bus D W r ite C o n tr o l R e g is te r C h ip R e s e t R e a d C o n tr o l R e g is te r
CK S
Q
DD
W EAK P u ll- u p M a s k O p tio n
D W r ite I/O CK S Q
Q
PA0~PA7 PB4~PB7
M R e a d I/O S y s te m W a k e - u p ( P A o n ly ) M a s k O p tio n U
X
Input/output ports
23 July 24, 2000
Preliminary
The PWM circuit provides two pad outputs: PWM2, PWM1 which can directly drive a piezo or a 32W speaker without adding any external element. Refer to the Application Circuits. The PWM clock source comes from the system clock divided by a 3-bit prescaler. Setting data to P0, P1 and P2 (bit 3, 4, 5 of 27H) can yield various clock sources. The clock source are use for PWM modulating clock and sampling clock. After setting the start bit (bit 0 27H) and the next falling edge coming from the prescaler, the DIV will generate a serial clock to PWM counter for modulating and PWMI for interrupt. The PWM counter latch data at the first F1 clock falling edge and the start counter at F1 rising edge. The F2 clock is synchronous with the first F1 clock and it is also connected to the PWM output latch. In setting the start bit initial status, the PWM1 DAC outputs a high level and change the output status to LOW while the 7 bits counter overflows. BZ/SP 0 0 1 1 6/7 Bit 0 1 0 1 F2 F1 (Sampling Rate F0 F0 F0 F0 F0/64 F0/128 F0/64 F0/128 Device 32W speaker 32W speaker Buzzer/8W speaker Buzzer/8W speaker
HTG2150
On the above table, we can easily see that the sampling rate is dependent on the system clock. If start bit is set to 0, the PWM2 and PWM1 will output a GND level voltage. Label D/A BZ/SP Bit P0~P2 D0, D1 D0 0 0 1 1 Bits 0 1 2 Function D/A control. 0:start ; 1:stop Output driver select 1:Buzzer ; 0:speaker PWM counter bit select 1:7 bits ; 0:6 bits
3 bits preload counter, 3~5 bit 5/4/3:000B~111B (0~7) bit 3:LSB 6, 7 PWMI
D1 Samping Time/PWM Interrupt 0 1 0 1 1 2 4 8 PWM control register bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7
7 bit D0 6 bit X
D1 D1
D2 D2
D3 D4 D5 D3 D4 D5
D6 D6
D7 D7
Note: F1: for PWM modulation clock and F2 for sampling clock. F0: system /[n+1] n=0~7 (n:3 bits preload counter)
F0
Note: X means dont care. bit7: Sign bit PWM data buffer
S ta r t b it L a tc h F1 F2 O n e s a m p lin g tim e 1 2 8 c lo c k
7 bits PWM counter bit
24 July 24, 2000
Preliminary
D a ta B u s
HTG2150
S y s te m
c lo c k
P r e s c a le r F0 F1
P W M D a ta B u ffe r (2 8 H ) V
DD
S ta r t b it 2 7 H .0 PW MI F2
D iv .
CK PE
7 B its C o u n te r O v e r flo w
DQ CK
QB
R
PW M 1 dac fo r 3 2 W S P K PW M 2 dac fo r 3 2 W S P K
27H.1=0 speaker
D a ta B u s
S y s te m
c lo c k
P r e s c a le r F0 F1
P W M D a ta B u ffe r (2 8 H ) V
DD
S ta r t b it 2 7 H .0 PW MI F2
D iv .
CK PE
7 B its C o u n te r O v e r flo w
DQ CK R
QB
S ig n b it P W M 1 d a c fo r B Z P W M 2 d a c fo r B Z
27H.1=1 buzzer
25
July 24, 2000
Preliminary
Mask option
HTG2150
The following shows many kinds of mask options in the HTG2150. All the mask options must be defined on order to ensure proper system functioning. No. 1 2 3 Mask Option WDT enable/disable selection. WDT can be enabled or disabled by mask option. Wake-up selection. This option defines the wake-up activity. External I/O pins (PA only) all have the capability to wake-up the chip from a HALT mode by a following edge. External interrupt input pin share with other function selection. INT/SEG37: INT can be set as an external interrupt input pin or LCD segment output pin. I/O pins share with other function selection. PB4/SEG33, PB5/SEG34, PB6/SEG35, PB7/SEG36: PB4, PB5, PB6, PB7 can be set as I/O pins or LCD segment output pins. Segment output pins share with other function selection. XIN/SEG39, XOUT/SEG38: SEG38, SEG39 ban be set as LCD segment output pins or XIN, XOUT pins be connected to a 32768Hz crystal. LCD bias register selection. This option describes the LCD bias current. There are three types of selection. * * Selectable as small, middle or large current.
S m a ll c u r r e n t
V 110kW 3 /4 V 110kW 2 /4 V 110kW 1 /4 V 110kW GND
DD DD DD DD
4
5
6 Note: *
M id d le c u r r e n t
V 60kW 3 /4 V 60kW 2 /4 V 60kW 1 /4 V 60kW GND
DD DD DD DD
L a rg e c u rre n t
V 10kW 3 /4 V 10kW 2 /4 V 10kW 1 /4 V 10kW GND
DD DD DD DD
26
July 24, 2000
Preliminary
Application Circuits
32W s p e a k e r /B u z z e r a p p lic a tio n 8W s p e a k e r a p p lic a tio n
HTG2150
OSCI C O M 0~C O M 7 SEG 0~SEG 39 (M a x .)
1 /4 B ia s LC D PANEL
OSCI C O M 0~C O M 7 SEG 0~SEG 39 (M a x .) V 32W SPK orB uzzer
1 /4 B ia s LC D PANEL V
DD
V
PW M1
DD
DD
8W SPK RES PW M2 8050
PW M2 RES
*
X IN /S E G 3 9
*
X IN /S E G 3 9
32768Hz
X O U T /S E G 3 8 IN T /S E G 3 7 PA0~PA7
32768Hz
X O U T /S E G 3 8 IN T /S E G 3 7 PA0~PA7
H TG 2150
H TG 2150
Note: * Optional capacitors can be added to get a more accurate frequency. Since each crystal has its own chararacteristics, the user should consult the crystal manufacturer for appropriate value of the external capacitors.
27
July 24, 2000
Preliminary
Instruction Set Summary
Mnemonic Arithmetic ADD A,[m] ADDM A,[m] ADD A,x ADC A,[m] ADCM A,[m] SUB A,x SUB A,[m] SUBM A,[m] SBC A,[m] SBCM A,[m] DAA [m] Add data memory to ACC Add ACC to data memory Add immediate data to ACC Add data memory to ACC with carry Add ACC to register with carry Subtract immediate data from ACC Subtract data memory from ACC Subtract data memory from ACC with result in data memory Subtract data memory from ACC with carry Subtract data memory from ACC with carry with result in data memory Decimal adjust ACC for addition with result in data memory AND data memory to ACC OR data memory to ACC Exclusive-OR data memory to ACC AND ACC to data memory OR ACC to data memory Exclusive-OR ACC to data memory AND immediate data to ACC OR immediate data to ACC Exclusive-OR immediate data to ACC Complement data memory Complement data memory with result in ACC Increment data memory with result in ACC Increment data memory Decrement data memory with result in ACC Decrement data memory 1 1(1) 1 1 1(1) 1 1 1(1) 1 1(1) 1(1) Description Instruction Cycle
HTG2150
Flag Affected Z,C,AC,OV Z,C,AC,OV Z,C,AC,OV Z,C,AC,OV Z,C,AC,OV Z,C,AC,OV Z,C,AC,OV Z,C,AC,OV Z,C,AC,OV Z,C,AC,OV C
Logic Operation AND A,[m] OR A,[m] XOR A,[m] ANDM A,[m] ORM A,[m] XORM A,[m] AND A,x OR A,x XOR A,x CPL [m] CPLA [m] INCA [m] INC [m] DECA [m] DEC [m] 1 1 1 1(1) 1(1) 1(1) 1 1 1 1(1) 1 1 1(1) 1 1(1) Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
Increment and Decrement
28
July 24, 2000
Preliminary
Mnemonic Rotate RRA [m] RR [m] RRCA [m] RRC [m] RLA [m] RL [m] RLCA [m] RLC [m] Data Move MOV A,[m] MOV [m],A MOV A,x Bit Operation CLR [m].i SET [m].i Branch JMP addr SZ [m] SZA [m] SZ [m].i SNZ [m].i SIZ [m] SDZ [m] SIZA [m] SDZA [m] CALL addr RET RET A,x RETI Table Read TABRDC [m] TABRDL [m] Read ROM code (current page) to data memory and TBLH Read ROM code (last page) to data memory and TBLH 2(1) 2(1) Jump unconditional Skip if data memory is zero Skip if data memory is zero with data movement to ACC Skip if bit i of data memory is zero Skip if bit i of data memory is not zero Skip if increment data memory is zero Skip if decrement data memory is zero Skip if increment data memory is zero with result in ACC Skip if decrement data memory is zero with result in ACC Subroutine call Return from subroutine Return from subroutine and load immediate data to ACC Return from interrupt 2 1(2) 1(2) 1(2) 1(2) 1(3) 1(3) 1(2) 1(2) 2 2 2 2 Clear bit of data memory Set bit of data memory 1(1) 1(1) Move data memory to ACC Move ACC to data memory Move immediate data to ACC 1 1(1) 1 Rotate data memory right with result in ACC Rotate data memory right Rotate data memory right through carry with result in ACC Rotate data memory right through carry Rotate data memory left with result in ACC Rotate data memory left Rotate data memory left through carry with result in ACC Rotate data memory left through carry 1 1(1) 1 1(1) 1 1(1) 1 1(1) Description Instruction Cycle
HTG2150
Flag Affected None None C C None None C C None None None None None None None None None None None None None None None None None None None None
29
July 24, 2000
Preliminary
Mnemonic Miscellaneous NOP CLR [m] SET [m] CLR WDT CLR WDT1 CLR WDT2 SWAP [m] SWAPA [m] HALT No operation Clear data memory Set data memory Clear Watchdog Timer Pre-clear Watchdog Timer Pre-clear Watchdog Timer Swap nibbles of data memory Swap nibbles of data memory with result in ACC Enter power down mode 1 1(1) 1(1) 1 1 1 1(1) 1 1 Description Instruction Cycle
HTG2150
Flag Affected None None None TO,PD TO*,PD* TO*,PD* None None TO,PD
Note: x: 8 bits immediate data m: 8 bits data memory address A: accumulator i: 0~7 number of bits addr: 13 bits program memory address O : Flag is affected - : Flag is not affected
(1) (2)
* : Flag may be affected by the execution status : If a loading to the PCL register occurs, the execution cycle of instructions will be delayed one for one more cycles (4 system clocks) : If a skip to the next instruction occurs, the execution cycle of instructions will be delayed one more cycle (4 system clocks). Otherwise the original instruction cycle(s) is unchanged. : or
(2)
(3) (1)
30
July 24, 2000
Preliminary
Instruction Definition
ADC A,[m] Description Operation Affected flag(s) TC2 3/4 ADCM A,[m] Description Operation Affected flag(s) TC2 3/4 ADD A,[m] Description Operation Affected flag(s) TC2 3/4 ADD A,x Description Operation Affected flag(s) TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O Add data memory and carry to accumulator
HTG2150
The contents of the specified data memory, accumulator and the carry flag are added simultaneously, leaving the result in the accumulator. ACC ACC+[m]+C
Add accumulator and carry to data memory The contents of the specified data memory, accumulator and the carry flag are added simultaneously, leaving the result in the specified data memory. [m] ACC+[m]+C
Add data memory to accumulator The contents of the specified data memory and the accumulator are added. The result is stored in the accumulator. ACC ACC+[m]
Add immediate data to accumulator The contents of the accumulator and the specified data are added, leaving the result in the accumulator. ACC ACC+x
31
July 24, 2000
Preliminary
ADDM A,[m] Description Operation Affected flag(s) TC2 3/4 AND A,[m] Description Operation Affected flag(s) TC2 3/4 AND A,x Description Operation Affected flag(s) TC2 3/4 ANDM A,[m] Description Operation Affected flag(s) TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4 TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O Add accumulator to data memory
HTG2150
The contents of the specified data memory and the accumulator are added. The result is stored in the data memory. [m] ACC+[m]
Logical AND accumulator with data memory Data in the accumulator and the specified data memory performs a bitwise logical_AND operation. The result is stored in the accumulator. ACC ACC AND [m]
Logical AND immediate data to accumulator Data in the accumulator and the specified data performs a bitwise logical_AND operation. The result is stored in the accumulator. ACC ACC AND x
Logical AND data memory with accumulator Data in the specified data memory and the accumulator performs a bitwise logical_AND operation. The result is stored in the data memory. [m] ACC AND [m]
32
July 24, 2000
Preliminary
CALL addr Description Subroutine call
HTG2150
The instruction unconditionally calls a subroutine located at the indicated address. The program counter increments once to obtain the address of the next instruction, and pushes this onto the stack. The indicated address is then loaded. Program execution continues with the instruction at this address. Stack PC+1 PC addr TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
CLR [m] Description Operation Affected flag(s)
Clear data memory The contents of the specified data memory are cleared to zero. [m] 00H TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
CLR [m].i Description Operation Affected flag(s)
Clear bit of data memory The bit i of the specified data memory is cleared to zero. [m].i 0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
CLR WDT Description Operation Affected flag(s)
Clear Watchdog Timer The WDT and the WDT Prescaler are cleared (re-counting from zero). The power down bit (PD) and time-out bit (TO) are cleared. WDT and WDT Prescaler 00H PD and TO 0 TC2 3/4 TC1 3/4 TO 0 PD 0 OV 3/4 Z 3/4 AC 3/4 C 3/4
33
July 24, 2000
Preliminary
CLR WDT1 Description Preclear Watchdog Timer
HTG2150
The PD, TO flags, WDT and the WDT Prescaler are cleared (re-counting from zero), if the other preclear WDT instruction had been executed. Execution of this instruction without the other preclear instruction only sets the indicating flag which implies that this instruction was executed and the PD and TO flags remain unchanged. WDT and WDT Prescaler 00H* PD and TO 0* TC2 3/4 TC1 3/4 TO 0* PD 0* OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
CLR WDT2 Description
Preclear Watchdog Timer The PD, TO flags, WDT and the WDT Prescaler are cleared (re-counting from zero), if the other preclear WDT instruction had been executed. Execution of this instruction without the other preclear instruction, only sets the indicating flag which implies that this instruction was executed and the PD and TO flags remain unchanged. WDT and WDT Prescaler 00H* PD and TO 0* TC2 3/4 TC1 3/4 TO 0* PD 0* OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
CPL [m] Description
Complement data memory Each bit of the specified data memory is logically complemented (1s complement). Bits which previously contain a one are changed to zero and vice-versa. [m] [m] TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
Operation Affected flag(s)
34
July 24, 2000
Preliminary
CPLA [m] Description Complement data memory and place result in accumulator
HTG2150
Each bit of the specified data memory is logically complemented (1s complement). Bits which previously contained a one are changed to zero and vice-versa. The complemented result is stored in the accumulator and the contents of the data memory remains unchanged. ACC [m] TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
Operation Affected flag(s)
DAA [m] Description
Decimal-Adjust accumulator for addition The accumulator value is adjusted to the BCD (Binary Code Decimal) code. The accumulator is divided into two nibbles. Each nibble is adjusted to the BCD code and an internal carry (AC1) will be done if the low nibble of the accumulator is greater than 9. The BCD adjustment is done by adding 6 to the original value if the original value is greater than 9 or a carry (AC or C) is set; otherwise the original value remains unchanged. The result is stored in the data memory and only the carry flag (C) may be affected. If (ACC.3~ACC.0) >9 or AC=1 then ([m].3~[m].0) (ACC.3~ACC.0)+6, AC1=AC else ([m].3~[m].0) (ACC.3~ACC.0), AC1=0 and If (ACC.7~ACC.4)+AC1 >9 or C=1 then ([m].7~[m].4) (ACC.7~ACC.4)+6+AC1, C=1 else ([m].7~[m].4) (ACC.7~ACC.4)+AC1, C=C TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C O
Operation
Affected flag(s)
DEC [m] Description Operation Affected flag(s)
Decrement data memory Data in the specified data memory is decremented by one. [m] [m] -1 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
35
July 24, 2000
Preliminary
DECA [m] Description Operation Affected flag(s) TC2 3/4 HALT Description TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4 Decrement data memory and place result in accumulator
HTG2150
Data in the specified data memory is decremented by one, leaving the result in the accumulator. The contents of the data memory remain unchanged. ACC [m]-1
Enter power down mode This instruction stops the program execution and turns off the system clock. The contents of the RAM and registers are retained. The WDT and prescaler are cleared. The power down bit (PD) is set and the WDT time-out bit (TO) is cleared. PC PC+1 PD 1 TO 0 TC2 3/4 TC1 3/4 TO 0 PD 1 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation
Affected flag(s)
INC [m] Description Operation Affected flag(s)
Increment data memory Data in the specified data memory is incremented by one. [m] [m]+1 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
INCA [m] Description Operation Affected flag(s)
Increment data memory and place result in accumulator Data in the specified data memory is incremented by one, leaving the result in the accumulator. The contents of the data memory remain unchanged. ACC [m]+1 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
36
July 24, 2000
Preliminary
JMP addr Description Operation Affected flag(s) TC2 3/4 MOV A,[m] Description Operation Affected flag(s) TC2 3/4 MOV A,x Description Operation Affected flag(s) TC2 3/4 MOV [m],A Description Operation Affected flag(s) TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 Direct Jump
HTG2150
Bits 0~12 of the program counter are replaced with the directly-specified address unconditionally, and control is passed to this destination. PC addr
Move data memory to accumulator The contents of the specified data memory is copied to the accumulator. ACC [m]
Move immediate data to accumulator The 8-bit data specified by the code is loaded into the accumulator. ACC x
Move accumulator to data memory The contents of the accumulator is copied to the specified data memory (one of the data memory). [m] ACC
37
July 24, 2000
Preliminary
NOP Description Operation Affected flag(s) TC2 3/4 OR A,[m] Description TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 No operation
HTG2150
No operation is performed. Execution continues with the next instruction. PC PC+1
Logical OR accumulator with data memory Data in the accumulator and the specified data memory (one of the data memories) performs a bitwise logical_OR operation. The result is stored in the accumulator. ACC ACC OR [m] TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
Operation Affected flag(s)
OR A,x Description Operation Affected flag(s)
Logical OR immediate data to accumulator Data in the accumulator and the specified data performs a bitwise logical_OR operation. The result is stored in the accumulator. ACC ACC OR x TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
ORM A,[m] Description
Logical OR data memory with accumulator Data in the data memory (one of the data memories) and the accumulator performs a bitwise logical_OR operation. The result is stored in the data memory. [m] ACC OR [m] TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
Operation Affected flag(s)
38
July 24, 2000
Preliminary
RET Description Operation Affected flag(s) TC2 3/4 RET A,x Description Operation Affected flag(s) TC2 3/4 RETI Description TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 Return from subroutine
HTG2150
Theprogramcounterisrestoredfromthestack.Thisisatwo-cycleinstruction. PC Stack
Return and place immediate data in accumulator The program counter is restored from the stack and the accumulator loaded with the specified 8-bit immediate data. PC Stack ACC x
Return from interrupt The program counter is restored from the stack, and interrupts are enabled by setting the EMI bit. EMI is the enable master (global) interrupt bit (bit 0; register INTC). PC Stack EMI 1 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
RL [m] Description Operation Affected flag(s)
Rotate data memory left The contents of the specified data memory is rotated one bit left, with bit 7 rotated into bit 0. [m].(i+1) [m].i; [m].i:bit i of the data memory (i=0-6) [m].0 [m].7 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
39
July 24, 2000
Preliminary
RLA [m] Description Rotate data memory left and place result in accumulator
HTG2150
Data in the specified data memory is rotated one bit left, with bit 7 rotated into bit 0, leaving the rotated result in the accumulator. The contents of the data memory remain unchanged. ACC.(i+1) [m].i; [m].i:bit i of the data memory (i=0-6) ACC.0 [m].7 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
RLC [m] Description
Rotate data memory left through carry The contents of the specified data memory and the carry flag are together rotated one bit left. Bit 7 replaces the carry bit; the original carry flag is rotated into the bit 0 position. [m].(i+1) [m].i; [m].i:bit i of the data memory (i=0-6) [m].0 C C [m].7 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C O
Operation
Affected flag(s)
RLCA [m] Description
Rotate left through carry and place result in accumulator Data in the specified data memory and the carry flag are together rotated one bit left. Bit 7 replaces the carry bit and the original carry flag is rotated into bit 0 position. The rotated result is stored in the accumulator but the contents of the data memory remain unchanged. ACC.(i+1) [m].i; [m].i:bit i of the data memory (i=0-6) ACC.0 C C [m].7 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C O
Operation
Affected flag(s)
40
July 24, 2000
Preliminary
RR [m] Description Operation Affected flag(s) TC2 3/4 RRA [m] Description TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 Rotate data memory right
HTG2150
The contents of the specified data memory are rotated one bit right with bit 0 rotated to bit 7. [m].i [m].(i+1); [m].i:bit i of the data memory (i=0-6) [m].7 [m].0
Rotate right and place result in accumulator Data in the specified data memory is rotated one bit right with bit 0 rotated into bit 7, leaving the rotated result in the accumulator. The contents of the data memory remain unchanged. ACC.(i) [m].(i+1); [m].i:bit i of the data memory (i=0-6) ACC.7 [m].0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
RRC [m] Description
Rotate data memory right through carry The contents of the specified data memory and the carry flag are together rotated one bit right. Bit 0 replaces the carry bit; the original carry flag is rotated into the bit 7 position. [m].i [m].(i+1); [m].i:bit i of the data memory (i=0-6) [m].7 C C [m].0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C O
Operation
Affected flag(s)
41
July 24, 2000
Preliminary
RRCA [m] Description Rotate right through carry and place result in accumulator
HTG2150
Data of the specified data memory and the carry flag are together rotated one bit right. Bit 0 replaces the carry bit and the original carry flag is rotated into the bit 7 position. The rotated result is stored in the accumulator. The contents of the data memory remain unchanged. ACC.i [m].(i+1); [m].i:bit i of the data memory (i=0-6) ACC.7 C C [m].0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C O
Operation
Affected flag(s)
SBC A,[m] Description
Subtract data memory and carry from accumulator The contents of the specified data memory and the complement of the carry flag are together subtracted from the accumulator, leaving the result in the accumulator. ACC ACC+[m]+C TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O
Operation Affected flag(s)
SBCM A,[m] Description
Subtract data memory and carry from accumulator The contents of the specified data memory and the complement of the carry flag are together subtracted from the accumulator, leaving the result in the data memory. [m] ACC+[m]+C TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O
Operation Affected flag(s)
42
July 24, 2000
Preliminary
SDZ [m] Description Skip if decrement data memory is zero
HTG2150
The contents of the specified data memory are decremented by one. If the result is zero, the next instruction is skipped. If the result is zero, the following instruction, fetched during the current instruction execution, is discarded and a dummy cycle is replaced to get the proper instruction. This makes a two-cycle instruction. Otherwise proceed with the next instruction. Skip if ([m]-1)=0, [m] ([m]-1) TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
SDZA [m] Description
Decrement data memory and place result in ACC, skip if zero The contents of the specified data memory are decremented by one. If the result is zero, the next instruction is skipped. The result is stored in the accumulator but the data memory remains unchanged. If the result is zero, the following instruction, fetched during the current instruction execution, is discarded and a dummy cycle is replaced to get the proper instruction, that makes a two-cycle instruction. Otherwise proceed with the next instruction. Skip if ([m]-1)=0, ACC ([m]-1) TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
SET [m] Description Operation Affected flag(s)
Set data memory Each bit of the specified data memory is set to one. [m] FFH TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
43
July 24, 2000
Preliminary
SET [m].i Description Operation Affected flag(s) TC2 3/4 SIZ [m] Description TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 Set bit of data memory Bit i of the specified data memory is set to one. [m].i 1
HTG2150
Skip if increment data memory is zero The contents of the specified data memory is incremented by one. If the result is zero, the following instruction, fetched during the current instruction execution, is discarded and a dummy cycle is replaced to get the proper instruction. This is a two-cycle instruction. Otherwise proceed with the next instruction. Skip if ([m]+1)=0, [m] ([m]+1) TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
SIZA [m] Description
Increment data memory and place result in ACC, skip if zero The contents of the specified data memory is incremented by one. If the result is zero, the next instruction is skipped and the result is stored in the accumulator. The data memory remains unchanged. If the result is zero, the following instruction, fetched during the current instruction execution, is discarded and a dummy cycle is replaced to get the proper instruction. This is a two-cycle instruction. Otherwise proceed with the next instruction. Skip if ([m]+1)=0, ACC ([m]+1) TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
44
July 24, 2000
Preliminary
SNZ [m].i Description Skip if bit i of the data memory is not zero
HTG2150
If bit i of the specified data memory is not zero, the next instruction is skipped. If bit i of the data memory is not zero, the following instruction, fetched during the current instruction execution, is discarded and a dummy cycle is replaced to get the proper instruction. This is a two-cycle instruction. Otherwise proceed with the next instruction. Skip if [m].i0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
SUB A,[m] Description Operation Affected flag(s)
Subtract data memory from accumulator The specified data memory is subtracted from the contents of the accumulator, leaving the result in the accumulator. ACC ACC+[m]+1 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O
SUBM A,[m] Description Operation Affected flag(s)
Subtract data memory from accumulator The specified data memory is subtracted from the contents of the accumulator, leaving the result in the data memory. [m] ACC [m]+1 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O
SUB A,x Description Operation Affected flag(s)
Subtract immediate data from accumulator The immediate data specified by the code is subtracted from the contents of the accumulator, leaving the result in the accumulator. ACC ACC+x+1 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV O Z O AC O C O
45
July 24, 2000
Preliminary
SWAP [m] Description Operation Affected flag(s) TC2 3/4 SWAPA [m] Description TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 Swap nibbles within the data memory
HTG2150
The low-order and high-order nibbles of the specified data memory (one of the data memories) are interchanged. [m].3~[m].0 [m].7~[m].4
Swap data memory and place result in accumulator The low-order and high-order nibbles of the specified data memory are interchanged, writing the result to the accumulator. The contents of the data memory remain unchanged. ACC.3~ACC.0 [m].7~[m].4 ACC.7~ACC.4 [m].3~[m].0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
SZ [m] Description
Skip if data memory is zero If the contents of the specified data memory is zero, the following instruction, fetched during the current instruction execution, is discarded and a dummy cycle is replaced to get the proper instruction. This is a two-cycle instruction. Otherwise proceed with the next instruction. Skip if [m]=0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
46
July 24, 2000
Preliminary
SZA [m] Description Move data memory to ACC, skip if zero
HTG2150
The contents of the specified data memory is copied to the accumulator. If the contents is zero, the following instruction, fetched during the current instruction execution, is discarded and a dummy cycle is replaced to get the proper instruction. This is a two-cycle instruction. Otherwise proceed with the next instruction. Skip if [m]=0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
SZ [m].i Description
Skip if bit i of the data memory is zero If bit i of the specified data memory is zero, the following instruction, fetched during the current instruction execution, is discarded and a dummy cycle is replaced to get the proper instruction. This is a two-cycle instruction. Otherwise proceed with the next instruction. Skip if [m].i=0 TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
TABRDC [m] Description
Move ROM code (current page) to TBLH and data memory The ROM code low byte (current page) addressed by the table pointer (TBLP), (TBHP) is moved to the specified data memory and the high byte transferred to TBLH directly. [m] ROM code (low byte) TBLH ROM code (high byte) TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4
Operation Affected flag(s)
47
July 24, 2000
Preliminary
TABRDL [m] Description Operation Affected flag(s) TC2 3/4 XOR A,[m] Description Operation Affected flag(s) TC2 3/4 XORM A,[m] Description TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z 3/4 AC 3/4 C 3/4 Move the ROM code (last page) to TBLH and data memory
HTG2150
The ROM code low byte (last page) addressed by the table pointer (TBLP) is moved to the data memory and the high byte transferred to TBLH directly. [m] ROM code (low byte) TBLH ROM code (high byte)
Logical XOR accumulator with data memory Data in the accumulator and the indicated data memory performs a bitwise logical Exclusive_OR operation and the result is stored in the accumulator. ACC ACC XOR [m]
Logical XOR data memory with accumulator Data in the indicated data memory and the accumulator perform a bitwise logical Exclusive_OR operation. The result is stored in the data memory. The zero flag is affected. [m] ACC XOR [m] TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
Operation Affected flag(s)
XOR A,x Description
Logical XOR immediate data to accumulator Data in the the accumulator and the specified data perform a bitwise logical Exclusive_OR operation. The result is stored in the accumulator. The zero flag is affected. ACC ACC XOR x TC2 3/4 TC1 3/4 TO 3/4 PD 3/4 OV 3/4 Z O AC 3/4 C 3/4
Operation Affected flag(s)
48
July 24, 2000
Preliminary
HTG2150
Holtek Semiconductor Inc. (Headquarters) No.3 Creation Rd. II, Science-based Industrial Park, Hsinchu, Taiwan, R.O.C. Tel: 886-3-563-1999 Fax: 886-3-563-1189 Holtek Semiconductor Inc. (Taipei Office) 5F, No.576, Sec.7 Chung Hsiao E. Rd., Taipei, Taiwan, R.O.C. Tel: 886-2-2782-9635 Fax: 886-2-2782-9636 Fax: 886-2-2782-7128 (International sales hotline) Holtek Semiconductor (Hong Kong) Ltd. RM.711, Tower 2, Cheung Sha Wan Plaza, 833 Cheung Sha Wan Rd., Kowloon, Hong Kong Tel: 852-2-745-8288 Fax: 852-2-742-8657 Copyright O 2000 by HOLTEK SEMICONDUCTOR INC. The information appearing in this Data Sheet is believed to be accurate at the time of publication. However, Holtek assumes no responsibility arising from the use of the specifications described. The applications mentioned herein are used solely for the purpose of illustration and Holtek makes no warranty or representation that such applications will be suitable without further modification, nor recommends the use of its products for application that may present a risk to human life due to malfunction or otherwise. Holtek reserves the right to alter its products without prior notification. For the most up-to-date information, please visit our web site at http://www.holtek.com.tw.
49
July 24, 2000


▲Up To Search▲   

 
Price & Availability of HTG2150

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X